import type { App, Component } from 'vue'
//需要注册为全局的组件
import ninthArtButton from './Buttons/NinthArtButton.vue'
import postCategoryButton from './Buttons/PostCategoryButton.vue'
import artFont from './Fonts/ArtFont.vue'
import bookCard from './Cards/BookCard.vue'
import moiveCard from './Cards/MoiveCard.vue'
import postCard from './Cards/PostCard.vue'
import websiteInfoCard from './Cards/WebsiteInfoCard.vue'
import movieCarousel from './Carousels/MovieCarousel.vue'
import projectCarousel from './Carousels/ProjectCarousel.vue'
import ninthArtCard from './Cards/NinthArtCard.vue'
import ninthTitle from './Fonts/NinthTitle.vue'
import svgIcon from './SvgIcon/SvgIcon.vue'
import projectCard from './Cards/ProjectCard.vue'
import goToButton from './Buttons/GoToButton.vue'

type ComponentMap = {
  [key: string]: Component
}

const components: ComponentMap = {
  ninthArtButton,
  postCategoryButton,
  artFont,
  bookCard,
  moiveCard,
  postCard,
  websiteInfoCard,
  movieCarousel,
  projectCarousel,
  ninthArtCard,
  ninthTitle,
  svgIcon,
  projectCard,
  goToButton,
}

//需要暴漏插件对象
export default {
  //必须叫做install 方法
  install(app: App) {
    Object.keys(components).forEach((key) => {
      app.component(key, components[key])
    })
  },
}
